// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

Item{
    id: _root
    visible: false

    MouseArea{
        anchors.fill: parent
        acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
        hoverEnabled: true
    }

    property real progressMax: 100
    property real progressMin: 0
    property real progressValue: 50
    property alias progressMessage: _message.text

    onVisibleChanged: {
        if(visible === true){
            //表示された
        }
    }

    DialogBase{
        id: _dlg
//        anchors.horizontalCenter: parent.horizontalCenter
//        y: parent.height * 0.3
        anchors.centerIn: parent
        width: parent.width * 3/4
        height: _col.height + _col.anchors.topMargin * 2 + titleHeight

        dialogTitle: "転送中..."
        property real percent: (_root.progressValue - _root.progressMin) / (_root.progressMax - _root.progressMin)

        Column{
            id: _col
            anchors.top: _dlg.titleBottom
            anchors.topMargin: 10
            anchors.horizontalCenter: parent.horizontalCenter
            Rectangle{
                width: _dlg.width * 0.9
                height: 20

                color: "#222222"
                border.color: "#888888"
                border.width: 1

                Rectangle{
                    id: _bar
                    x: parent.border.width
                    y: parent.border.width
                    width: (parent.width - parent.width * _dlg.percent) - parent.border.width * 2
                    height: parent.height - parent.border.width
                    color: "#dd5555"
                }

                Text{
                    id: _progressValue
                    anchors.centerIn: parent
                    text: (100 - 100 * _dlg.percent) + "%"
                    color: "#dddddd"
                }
            }
            Text{
                id: _message
                text: "msg"
                color: "#dddddd"
            }
        }
    }
}
